package models;

import java.sql.ResultSet;
import java.sql.SQLException;

public class 
StoredModel 
extends AbstractModel
{	public boolean
	insert(String sname, Integer upc, Integer stock)
	{	try{
			ps = con.prepareStatement("INSERT INTO Stored VALUES (?,?,?)");
			ps.setString(1, sname);
			ps.setInt(2, upc);
			ps.setInt(3, stock);
			return wrapUp();
		} catch(SQLException ex){ return registerException(ex); }
	}
	
	public boolean delete(String sname, int upc)
	{ 	
		try
		{
			ps = con.prepareStatement("DELETE FROM Stored WHERE sname = ? AND upc = ?");
			ps.setString(1, sname);
			ps.setInt(2, upc);
			return wrapUp();
		} 
		catch(SQLException ex)
		{ 
			return registerException(ex); 
		}
	}	
	
	public ResultSet
	show()
	{ return super.show("Stored"); }
}
